package com.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.demo.dao.TournamentArrangementDao;
import com.demo.domain.TournamentArrangement;
import com.demo.service.TournamentArrangementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TournamentArrangementServiceImpl extends ServiceImpl<TournamentArrangementDao, TournamentArrangement> implements TournamentArrangementService {
    @Autowired
    private TournamentArrangementDao arrangementDao;

    /**
     * 获取所有的赛程安排
     * @return
     * @throws Exception
     */
    @Override
    public List<TournamentArrangement> getAllArrangements() throws Exception {
        LambdaQueryWrapper<TournamentArrangement> wrapper=new LambdaQueryWrapper<>();
        wrapper.eq(TournamentArrangement::getDelFlag,0);
        List<TournamentArrangement> list=arrangementDao.selectList(wrapper);
        if (list!=null&&list.size()>0){
            for (TournamentArrangement arrangement:list){
                arrangement.setTaStartMonth();
            }
        }
        return list;
    }
}
